package com.lq.mytool.controller;

import com.lq.mytool.common.BaseResponse;
import com.lq.mytool.entity.SxTodoInfo;
import com.lq.mytool.enums.AttendancePunchWayTypeEnum;
import com.lq.mytool.service.ISxTodoInfoService;
import com.lq.mytool.strategy.PunchWayFactory;
import com.lq.mytool.strategy.dto.HrmsAttendancePunchConfigAddParam;
import com.lq.mytool.strategy.dto.HrmsAttendancePunchWayConfigParam;
import com.lq.mytool.strategy.dto.PlacePunchWayDTO;
import com.lq.mytool.strategy.dto.WifiPunchWayDTO;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/test")
@Slf4j
public class TestController {
    @Autowired
    private ISxTodoInfoService iSxIndustryService;


    @ApiOperation("测试接口")
    @RequestMapping(value = "/ok" ,method = RequestMethod.GET)
    public BaseResponse test(){
        log.info("Ceshi占位符：{}","LQ");
        return BaseResponse.success("iSxIndustryService.selectList()");
    }



    @ApiOperation("策略接口")
    @RequestMapping(value = "/stage" ,method = RequestMethod.POST)
    public BaseResponse stage(@RequestBody HrmsAttendancePunchConfigAddParam addParam){
        for (HrmsAttendancePunchWayConfigParam param :addParam.getPunchWayConfig()) {
            PunchWayFactory.getPunchWayStrategy(AttendancePunchWayTypeEnum.valueOf(param.getPunchWayType())).checkParam(param.getPunchWayConfig());
        }
        return BaseResponse.success();
    }

    @RequestMapping(value = "/ok222" ,method = RequestMethod.POST)
    public BaseResponse test11(@RequestBody WifiPunchWayDTO wifiPunchWayDTO){
        log.info("Ceshi占位符：{}","LQ");
        return BaseResponse.success("iSxIndustryService.selectList()");
    }

    @RequestMapping(value = "/ok2223" ,method = RequestMethod.POST)
    public BaseResponse test131(@RequestBody PlacePunchWayDTO wifiPunchWayDTO){
        log.info("Ceshi占位符：{}","LQ");
        String ts = "{" +
                "  \"macAddress\": \"string\",\n" +
                "  \"wifiName\": \"string\"\n" +
                "}";
        return BaseResponse.success("iSxIndustryService.selectList()");
    }
}
